package libraryPSI;

import java.util.StringTokenizer;

/**
 * Created by User on 19.01.14.
 */
public class Book {
    private int id=1;
    private String name;
    private String author;

    public Book(int id, String name, String author) {
        this.id = id;
        this.name = name;
        this.author = author;
    }

    public Book(String fromFile) {
        StringTokenizer tokenizer = new StringTokenizer(fromFile, "|");
        this.id = Integer.parseInt(tokenizer.nextToken());
        this.name = tokenizer.nextToken();
        this.author = tokenizer.nextToken();
    }
    public int getId() {
        return id++;
    }

    public String getName() {return name; }

    public String getAuthor() {
        return author;
    }

    @Override
    public String toString() {
        return id + "|" + name + "|" + author;
    }


}
